//
//  BaseTabBarController.swift
//  ZJProject
//
//  Created by HyBoard on 2019/7/12.
//  Copyright © 2019 HyBoard. All rights reserved.
//

import UIKit

class BaseTabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        setSubviews()
        self.delegate = self
    }
    
    fileprivate func setSubviews() {
        
        let titleArray = ["Home","Library","Music","Movie","Profile"]
        var navArray = [UIViewController]()
        for i in 0..<titleArray.count {
            
            let vc = HomeViewController()
            let nav = BaseNavigationController(rootViewController: vc)
            vc.navTitle = titleArray[i]
            nav.tabBarItem.title = titleArray[i]
            navArray.append(nav)
        }
        viewControllers = navArray
    }

}

extension BaseTabBarController: UITabBarControllerDelegate {
    
//    func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
//
//        let vc = LoginViewController()
//        let nav = BaseNavigationController(rootViewController: vc)
//        viewController.present(nav, animated: true, completion: nil)
//
//        return false
//    }
}
